home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
LANG
/
C
/
GCC
/
V2-4-5
/
GCCEXTSR
/
Virtual
/
!Virtual
/
h
/
virtual
< prev
next >
Wrap
Text File
|
1993-09-06
|
5KB
|
142 lines
/*
* virtual.h
* Part of the !Virtual distribution
* (c) bdb/nas/fo, 1992-3
*/
/* Terminology:
* Place - addresses in memory, counted in pagesize, offset by 32K OS workspace
* Page - index into newpages array of pages we can use
* Slot - place in file where we can put something
*/
/* Values stored in ourmem for each place: tag+value */
#define TAG(x) ((x)>>28)
#define LOC(x) ((x)&0xFFFFFFF)
#define TAGLOC(x, y) (((x)<<28)+y)
#define DIRTY 0 /* written LOC=page */
#define SAVED 1 /* read only LOC=slot, index[slot]=page */
#define PAGED 2 /* paged out LOC=slot, index[slot]=place */
#define LOSE 3 /* page is candidate for paging out, but still there */
#define ZERO 4 /* Zero fill this page when hit */
#define ABORT 5 /* Error to hit this page */
#define ADDR(n) ((n)<<w->pageshift)
#define PLACE(n) ((n)>>w->pageshift)
#define SHUFT(n) ((n)%w->pagesize)
#define REFT(n) (w->pagesize-SHUFT(n))
typedef struct PAGEENTRY
{ int pagenum;
int addr;
int access;
} PAGEENTRY;
#define ACCESS_READWRITE 0
#define ACCESS_READONLY 1
#define ACCESS_SVCONLY 2
#define ACCESS_BAD 3
#define K32 (32*1024)
#define M24 (24*1024*1024)
#define DUMPADDR ((31*1024+32)*1024) /* dump pages here (where Wimp does) */
#define LOCKADDRBIT 1 /* Set in newpages.addr during page in code */
/* per task workspace */
typedef struct private
{
int uses;
struct WKSP *w; /* last touched w */
} private;
typedef struct WKSP
{
int regs[16];
#define STACKSIZE 8000
char *stacktop; /* stack to use to call C */
private *private; /* link back to module private workspace */
int ourtask; /* Us */
int pagesize; /* mem page size/bytes */
int numpages; /* total # pages in system [hence size of oldpages/newpages] */
int pageshift; /* log2 pagesize */
int numplaces; /* number of places in logical memory */
int *ourmem; /* TAG+data for each place */
int numourpages; /* number of pages we have to play with (at start of newpages) */
PAGEENTRY *oldpages; /* How pages found (0..numourpages were at 32K) */
PAGEENTRY *newpages; /* New state we set up */
int losepage; /* next page to swap out */
char pagefilename[256];
int pagefile; /* file handle we page to */
int nslots; /* current number of slots in pagefile */
int *index; /* data or -1 for each slot in pagefile */
int OldPrefetchAbort;
int OldDataAbort;
int OldSWIV;
int OldCallBack;
int OldCallBackR12;
int OldCallBackRegs;
int OldUpCall;
int OldUpCallR12;
int OldError;
int OldErrorR0;
int OldErrorBuf;
int OldExit;
int OldExitR12;
int errPC;
int errnum;
char errmess[256];
int outtask; /* taskwindow server task */
int outblock[6]; /* used to build a wimp message around outbuf */
#define OUTMAX (256-24)
char outbuf[OUTMAX]; /* output characters */
int outcount; /* count */
#define INSIZE 256
char inbuf[INSIZE]; /* circular input buffer */
int incount; /* number in it */
int instart; /* position of start */
int innbytes; /* record of amount asked for in ramfetch */
int moreavailable; /* flag that theres more to ramtransmit to us */
int EscapeChar; /* character that causes escape */
int EscapeCharEnable; /* enable above */
char command[256]; /* command line read by OS_GetEnv */
char starttime[5]; /* App start time read by OS_GetEnv */
int MemoryLimit;
int UndefinedInstruction;
int PrefetchAbort;
int DataAbort;
int AddressException;
int OtherExceptions;
int Error,ErrorR0,ErrorBuf;
int CallBack,CallBackR12,CallBackBuf;
int BreakPoint,BreakPointR12,BreakPointBuf;
int Escape,EscapeR12;
int Event,EventR12;
int Exit,ExitR12;
int UnusedSWI,UnusedSWIR12;
int ExceptionRegs;
int ApplicationSpace;
int CurrentlyActiveObject;
int UpCall,UpCallR12;
int EscapeCondition; /* 1 escape, 2 done handler */
int started_ingos;
int ingos;
int nice_run; /* Running time for OS_CallEvery, cs */
int nice_delay; /* Delay for Wimp_PollIdle, cs */
char *DDECL;
int DDECLSize;
} WKSP;